#ifndef BOARD_H
#define BOARD_H

#include <QWidget>
#include <QPainter>
#include "stone.h"
#include "step.h"

class Board : public QWidget
{
    Q_OBJECT
public:
    explicit Board(QWidget *parent = 0);\
    Stone stones[32];
    int d, r, selectId;
    void init();
    void paintEvent(QPaintEvent *);
    void mouseReleaseEvent(QMouseEvent *event);
    virtual void clickHandler(int clickId, int row, int col);
    bool isRedTurn;
    QVector<Step*> steps;
    bool canMove(int id, int row, int col);
    int getStoneId(int row, int col); //判断该行列位置有没没棋子并返回ID
    int countAtLine(int, int, int, int); //统计直线上棋子个数
    void moveStone(int id, int row, int col); //移动第id个棋子到row行col列
    void saveStep(int fromId, int rowTo, int colTo, int targetId);
    void checkWin();
    void backOne();

signals:

public slots:
    void slotBack();

};

#endif // BOARD_H
